home *** CD-ROM | disk | FTP | other *** search
- /*
- ** GadTools layout toolkit
- **
- ** Copyright © 1993-1996 by Olaf `Olsen' Barthel
- ** Freely distributable.
- **
- ** :ts=4
- */
-
- #ifndef _GTLAYOUT_GLOBAL_H
- #include "gtlayout_global.h"
- #endif
-
- LONG
- LTP_GetDepth(struct BitMap *BitMap)
- {
- if(V39)
- return((LONG)GetBitMapAttr(BitMap,BMA_DEPTH));
- else
- return(BitMap->Depth);
- }
-
- VOID
- LTP_DeleteBitMap(struct BitMap *BitMap,BOOL Chip)
- {
- if(V39 && !Chip)
- FreeBitMap(BitMap);
- else
- {
- if(BitMap)
- {
- LONG i;
-
- for(i = 0 ; i < BitMap->Depth ; i++)
- FreeVec(BitMap->Planes[i]);
-
- FreeVec(BitMap);
- }
- }
- }
-
- struct BitMap *
- LTP_CreateBitMap(LONG Width,LONG Height,LONG Depth,struct BitMap *Friend,BOOL Chip)
- {
- struct BitMap *BitMap;
-
- if(V39 && !Chip)
- BitMap = AllocBitMap(Width,Height,Depth,BMF_MINPLANES,Friend);
- else
- {
- if(BitMap = (struct BitMap *)AllocVec(sizeof(struct BitMap),MEMF_ANY | MEMF_PUBLIC))
- {
- LONG PageSize;
- LONG i;
-
- InitBitMap(BitMap,Depth,Width,Height);
-
- PageSize = BitMap->BytesPerRow * BitMap->Rows;
-
- for(i = 0 ; i < Depth ; i++)
- {
- if(!(BitMap->Planes[i] = (PLANEPTR)AllocVec(PageSize,MEMF_CHIP)))
- {
- LONG j;
-
- for(j = 0 ; j < i ; j++)
- FreeVec(BitMap->Planes[j]);
-
- FreeVec(BitMap);
-
- return(NULL);
- }
- }
- }
- }
-
- return(BitMap);
- }
-